﻿#ifndef ELEMENTREADER_H
#define ELEMENTREADER_H
#include "qvector4d.h"
#include <QFile>
#include <QDomComment>
#include <QVector3D>
#include <QMap>

typedef enum F_TYPE
{
    Revolute,
    Fixed,
    TransLate,
    RevAndTrans
};
typedef struct MoD
{
    QString name;
    QVector3D rpy;
    QVector3D pos;
    QString path;
    QVector4D color;
};
typedef struct JOINT
{
    QString Name;
    F_TYPE type;
    QString prenode;
    QVector3D rpy;
    QVector3D pos;
    QVector3D dir={0,0,1};
    int min;
    int max;
    int vellimet;
    int acclimit;
    QList<MoD> modelpath;
};

class elementReader
{
public:
    elementReader();
    static elementReader* Instance()
    {
        if(reader==nullptr)
        {
            reader=new elementReader;
        }
        return reader;
    }
    void getInitilizationFile(QString file);
    QMap<QString,JOINT> getdatamap()
    {
        return jmap;
    }
    QString getfiledir();
private:
    void readconfig();

private:
    static elementReader* reader;
    QString filedir;
    QString configfile;
    QMap<QString,JOINT> jmap;
};

#endif // ELEMENTREADER_H
